#ifndef _MYRDIS_H_
#define _MYRDIS_H_

#include <string.h>
#include <stdio.h>
#include <pthread.h>
#include <hiredis/hiredis.h>
#include <iostream>
#include <string>

using std::cout;
using std::endl;
using std::string;


class MyHredis
{
public:
    static MyHredis *getInstance();
    static void init();
    string get(string key);
    void set(string key, string value);
    static void destory();
private:
    static MyHredis *_pInstance;
    redisContext* _pConnect;
    redisReply*_pReply;
    static pthread_once_t _once;
    void connect(const string &host,const int port);
private:
    MyHredis();
};//end of MyRedis;
#endif
